#!/bin/bash

# created by: JiangHongTiao
# jianghongtiao@gmail.com
#
# Arguments
# @param
#
#BUGS

ExportDir="release"
version="1.2011.1010"

if [ -d "$ExportDir" ]; then
  echo "Delete content: $ExportDir";
  rm -rf $ExportDir
fi

if [ ! -d "$ExportDir" ]; then
  echo "Create Path: $ExportDir";
  mkdir $ExportDir
fi

echo "Create temporary directory: $ExportDir/Temp"
mkdir "$ExportDir/Temp"

for actual in "ares-api" "common-persist" "common-utils" "core" "site-search" "multi-thread-downloader" "web-search"
do
  echo "Copy libraries from: $actual"
  cp -rup "./$actual/target/lib" "$ExportDir" 
  cp -up "./$actual/target/"$actual"-"$version".jar" "$ExportDir/lib" 
done

mv "$ExportDir/lib/core-"$version".jar" $ExportDir

echo "Copy: resources, settings"
cp -ru "resources" "$ExportDir"
cp -ru "settings" "$ExportDir"

chmod +x "$ExportDir/core-"$version".jar"






